#{extends 'main.html' /}
#{set title:'Pending Requests' /}

#{if flash.success}
	<p>${flash.success}</p>
#{/if}
#{if courses}
	<ul>
		#{list items:courses, as:'course'}
		<li><a href="@{list(1)}&courseId=${course.id}">${course.toString()}</a> (${course.getTotalRequests()})</li>
		#{/list}
	</ul>
#{/if}
#{else}
	#{if students}
		<ul>
			#{list items:students, as:'student'}
			<li><a href="@{list(2)}&studentId=${student.id}">${student.studentID} ${student.username}</a> (${student.requests.size()})</li>
			#{/list}
		</ul>
	#{/if}
	#{else}
		#{if requests}
			<form action="@{process()}">
			<input type="hidden" name="url" value="${request.url}" />
			<ul >
				#{list items:requests, as:'req'}
				<li><div>${req.student.username} &raquo; ${req.tutorial.course.code} ${req.tutorial.toString()}</div><div style="font-size:10px;"><input type="radio" name="r_${req.id}" value="1"/> Accept <input type="radio" name="r_${req.id}" value="2"/> Decline <input type="radio" name="r_${req.id}" value="0" checked/> -nothing-</div></li>
				#{/list}
			</ul>
			<input type="submit" value="Process"/>
			</form>
		#{/if}
		#{else}
			<p>No pending requests to view</p>
		#{/else}
	#{/else}
#{/else}